package com.md.notes.util;

import java.lang.reflect.Array;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CheckUtils {

	public static void main(String[] args) {
		String aString = "dsfdsfsdfsd234234";
		//System.out.println(checkIsNull(aString));
	}

	public static boolean checkIsNull(Object obj) {

		if (null == obj) {
			return true;
		} else if (obj instanceof CharSequence) {
			if (((CharSequence) obj).length() == 0) {
				return true;
			}
			String paramString = obj.toString().toLowerCase();
			if ("null".equals(paramString)) {
				return true;
			}
		} else if (obj instanceof Collection) {
			return ((Collection) obj).isEmpty();
		} else if (obj instanceof Map) {
			return ((Map) obj).isEmpty();
		} else if (obj.getClass().isArray()) {
			return Array.getLength(obj) == 0;
		}

		return false;
	}





}
